<template>
	<view class="box-detail">
		<view class="item-index-top">
			<view class="item-top-text">项目收入统计</view>
		</view>
		<view class="box-detail-content">
			<view class="uni-form-item form-item date-pick-style">
				<view class="title">测算基本奖励</view>
				<input class="uni-input form-input" v-model="sendData.CALCULATE_BASE_BONUS" name="input" placeholder="请输入测算基本奖励" disabled=""/>
				<view class="text-input-hou">( 元 )</view>
			</view>
			<view class="uni-form-item form-item date-pick-style">
				<view class="title">测算基本奖励日期</view>
				<uni-datetime-picker class="form-picker" type="date" :value="sendData.CALCULATE_BASE_BONUS_DATE" start="2000-2-31" end="3050-12-30" @change="dateChange1" disabled=""></uni-datetime-picker>
				<image src="../../../../static/images/icon_calendar.png" mode=""></image>
			</view>
			
			<view class="uni-form-item form-item date-pick-style">
				<view class="title">测算达成奖励</view>
				<input class="uni-input form-input" v-model="sendData.CALCULATE_STAND_BONUS" name="input" placeholder="请输入测算达成奖励" disabled=""/>
				<view class="text-input-hou">( 元 )</view>
			</view>
			<view class="uni-form-item form-item date-pick-style">
				<view class="title">测算达成奖励日期</view>
				<uni-datetime-picker class="form-picker" type="date" :value="sendData.CALCULATE_STAND_BONUS_DATE" start="2000-2-31" end="3050-12-30" @change="dateChange2" disabled=""></uni-datetime-picker>
				<image src="../../../../static/images/icon_calendar.png" mode=""></image>
			</view>
			
			<view class="uni-form-item form-item date-pick-style">
				<view class="title">实际基本奖励</view>
				<input class="uni-input form-input" v-model="sendData.BASE_BONUS" name="input" placeholder="请输入实际基本奖励"/>
				<view class="text-input-hou">( 元 )</view>
			</view>
			<view class="uni-form-item form-item date-pick-style">
				<view class="title">实际基本奖励日期</view>
				<uni-datetime-picker class="form-picker" type="date" :value="sendData.BASE_BONUS_DATE" start="2000-2-31" end="3050-12-30" @change="dateChange3"></uni-datetime-picker>
				<image src="../../../../static/images/icon_calendar.png" mode=""></image>
			</view>
			
			<view class="uni-form-item form-item date-pick-style">
				<view class="title">实际达成奖励</view>
				<input class="uni-input form-input" v-model="sendData.STAND_BONUS" name="input" placeholder="请输入实际达成奖励"/>
				<view class="text-input-hou">( 元 )</view>
			</view>
			<view class="uni-form-item form-item date-pick-style">
				<view class="title">实际达成奖励日期</view>
				<uni-datetime-picker class="form-picker" type="date" :value="sendData.STAND_BONUS_DATE" start="2000-2-31" end="3050-12-30" @change="dateChange4"></uni-datetime-picker>
				<image src="../../../../static/images/icon_calendar.png" mode=""></image>
			</view>
		</view>
		<view class="item-index-top">
			<view class="item-top-text">运营奖励 (万元)</view>
		</view>
		
		<!-- 销售情况start -->
		<view class="box-detail-content" v-if="!showList.length">
			<view class="box-detail-content-item">
				<view class="row-title">序号</view>
				<view class="row-content">1</view>
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">年份</view>
				<view class="row-content">无</view>
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">测算运营奖励（元）</view>
				<view class="row-content">无</view>
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">实际运营奖励（元）</view>
				<view class="row-content">无</view>
			</view>
		</view>
		<view class="box-detail-content" v-for="item,index in showList" v-if='item.leixing!==3' :key="index">
			<view class="box-detail-content-item">
				<view class="row-title">序号</view>
				<view class="row-content">{{index+1}}</view>
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">年份</view>
				<uni-datetime-picker class="form-picker" type="date" :value="item.YEAR" start="2000-2-31" end="3050-12-30" @change="dateChange5($event,index)" disabled=""></uni-datetime-picker>
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">测算运营奖励（元）</view>
				<input class="uni-input form-input " v-model="item.PLAN_BONUS" name="input" placeholder="请填写测算运营奖励" disabled=""/>
			</view>
			<view class="box-detail-content-item">
				<view class="row-title">实际运营奖励（元）</view>
				<input class="uni-input form-input " v-model="item.REAL_BONUS" name="input" placeholder="请填写实际运营奖励" disabled=""/>
			</view>
			<!-- <view class="delete-item" @click="deleteItem(index)"></view> -->
		</view>
		<!-- <view class="add-box-detail-content border-wid" @click="addItem"></view> -->
		<!-- 销售情况end -->
	</view>
</template>

<script>
	export default {
		data(){
			return{
				code:'',
				date:'',
				showList:[],
				deleteList:[],
				sendData:{},
	
			}
		},
		props: {
			pageData: {
				type: Object,
				default(){
					return {}
				}
			}
		},
		watch:{
			pageData(){
				this.sendData={
					CALCULATE_BASE_BONUS:this.pageData.model.CALCULATE_BASE_BONUS,
					CALCULATE_BASE_BONUS_DATE:this.pageData.model.CALCULATE_BASE_BONUS_DATE,
					
					CALCULATE_STAND_BONUS:this.pageData.model.CALCULATE_STAND_BONUS,
					CALCULATE_STAND_BONUS_DATE:this.pageData.model.CALCULATE_STAND_BONUS_DATE,
					
					BASE_BONUS:this.pageData.model.BASE_BONUS,
					BASE_BONUS_DATE:this.pageData.model.BASE_BONUS_DATE,
					
					STAND_BONUS:this.pageData.model.STAND_BONUS,
					STAND_BONUS_DATE:this.pageData.model.STAND_BONUS_DATE,
				}
				if(this.pageData.dataGrid.Bonus_view.datas.length>0){
					this.sendData.listData=[]
					this.showList=[]
					this.pageData.dataGrid.Bonus_view.datas.map(item=>{
						this.projectId=item.PROJ_ID
						this.sendData.listData.push({
							datakey:item.DATAKEY,
							proid:item.PROJ_ID,
							YEAR:item.YEAR,
							PLAN_BONUS:item.PLAN_BONUS,
							REAL_BONUS:item.REAL_BONUS,
							leixing:0,//操作类型
						})
						this.showList=this.sendData.listData
					})
				}else{
					this.sendData.listData=[]
					this.showList=this.sendData.listData
				}
			},
		},
		
		methods:{
			dateChange1(e) {
				this.date = e
				this.sendData.CALCULATE_BASE_BONUS_DATE=e 
			},
			dateChange2(e) {
				this.date = e
				this.sendData.CALCULATE_STAND_BONUS_DATE=e 
			},
			dateChange3(e) {
				this.date = e
				this.sendData.BASE_BONUS_DATE=e 
			},
			dateChange4(e) {
				this.date = e
				this.sendData.STAND_BONUS_DATE=e 
			},
			dateChange5(e,index) {
				this.date = e
				this.showList[index].YEAR=e 
			},
			addItem(){
				this.showList.push({
					datakey: this.getUUID(),
					proid:this.projectId,
					YEAR:'',
					PLAN_BONUS:'',
					REAL_BONUS:'',
					leixing:1, //操作类型  新增行标记为1，删除行标记为3，修改行不处理保留原值0
				})
			},
			deleteItem(index){
				if(index===0&&this.showList.length===1){
					this.showList=[]
				}else{
					if(this.showList[index].leixing===0){
						this.deleteList.push({
							datakey: this.showList[index].datakey,
							proid:this.showList[index].proid,
							MONTH:this.showList[index].MONTH,//主体名称
							MONTH_SALE:this.showList[index].MONTH_SALE,//当月销售收入
							TOTAL_SALE:this.showList[index].TOTAL_SALE,//累积销售收入
							leixing:3, //操作类型  新增
						})
						this.showList.splice(index,1)
					}else if(this.showList[index].leixing===1){
						this.showList.splice(index,1)
					}
				}	
			},
			getUUID() {
			   var s = [];
			   var hexDigits = "0123456789abcdef";
			   for (var i = 0; i < 36; i++) {
			    s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
			   }
			   s[14] = "4"; 
			   s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); 
			   s[8] = s[13] = s[18] = s[23] = "";
			
			   var uuid = s.join("");
			   return uuid;
			}
		},
	}
</script>

<style lang="scss" scoped>
	.wrap{
		padding-bottom: 60rpx;
	}
	page{
		padding-bottom: 20rpx;
	}
	.box-detail {
		background-color: #ffffff;
		border-radius: 20rpx;
		margin: 20rpx;
		padding: 26rpx 30rpx 50rpx 30rpx;
	}
	.item-index-top{
		// width: 650rpx;
		height: 40rpx;
		// margin: 20rpx 20rpx 18rpx 20rpx;
		background-color: #0099cc;
		border-radius: 10rpx;
		.item-top-text{
			font-family: AlibabaPuHuiTi-Regular;
			padding-left: 20rpx;
			font-size: 26rpx;
			font-weight: normal;
			line-height: 40rpx;
			letter-spacing: 0px;
			color: #ffffff;
		}
	}
	.textarea-style{
		// height:156rpx ;
	}
	.border-bot{
		border-bottom: 1px solid #e8f0f2;
	}
	.border-width{
		border-bottom: 3rpx solid #e8f0f2;
	}
	
	.box-detail-content {
		padding: 0 10rpx;
		margin-top: 24rpx;
	
		&.border {
			border-bottom: 1px solid #e8f0f2;
		}
	}
	
	.box-detail-content-row {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	
		.row-title {
			font-size: 26rpx;
			color: #9a9a9a;
			text-align: left;
			flex-shrink: 0;
			width: 120rpx;
			margin-right: 10rpx;
	
			&.mag {
				margin-left: 18rpx;
			}
		}
	
		.row-content {
			font-size: 26rpx;
			color: #414a5d;
			word-wrap: break-word;
			word-break: break-all;
			flex: 1;
			text-align: right;
	
			&.mag {
				margin-right: 18rpx;
			}
		}
	}
	
	.bar-contact {
		background-color: #0099cc;
		border-radius: 10px;
		height: 40rpx;
		line-height: 40rpx;
		padding-left: 18rpx;
		color: #FFFFFF;
		font-size: 24rpx;
	
	}
	.box-attach-style{
		display: flex;
		padding: 0 10rpx;
	}
	.box-attach{
		margin-top: 20rpx;
		padding: 20rpx 10rpx 0 10rpx;
		border-top: 1px solid #e8f0f2;
	
		.box-attach-title{
			width: 170rpx;
			font-size: 26rpx;
			color: #9a9a9a;
			text-align: left;
			flex-shrink: 0;
			margin-right: 10rpx;
		}
		.box-attach-row {
			display: flex;
			flex-direction: row;
			justify-content: flex-start;
			// align-items: center;
			// padding: 0 18rpx;
			// height: 38rpx;
			margin: 10rpx 0;
			.box-attach-icon {
				width: 34rpx;
				height:40rpx;
				margin-right: 20rpx;
				// background-image: url(../../../../static/images/icon_enclosure.png);
				// box-sizing: 34rpx 40rpx;
				// background-repeat: no-repeat;
				image{
					width: 100%;
					height: 100%;
				}
			}
			.box-attach-name {
				word-wrap: break-word;
				word-break: break-all;
				white-space: pre-line;
				flex: 1;
				font-size: 26rpx;
				color: #0099cc;
			}
		}
	}
	
	.fixed-action-bar {
		width: 100%;
		display: flex;
		height: 70rpx;
		align-items: center;
		background: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 999;
	
		.item {
			width: 50%;
			display: flex;
			justify-content: center;
			align-items: center;
	
		}
	
		.icon {
			width: 30rpx;
		}
	
		.btn-box {
			width: 90rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 70rpx;
		}
	
		.text-edit {
			font-size: 24rpx;
			color: #0099cc;
			line-height: 70rpx;
		}
	
		.text-delete {
			font-size: 24rpx;
			color: #cc3357;
			line-height: 70rpx;
		}
		
	}
	.uni-form-item{
		display: flex;
		justify-content: flex-start;
		margin-bottom: 20rpx;
	}
	
	.uni-input{
		font-size: 26rpx;
		color: #808080;
		// border-bottom:1px solid #dce4e6;
		flex:1;
	}
	.title{
		width: 220rpx;
		flex-shrink: 0;
		font-size: 26rpx;
		color: #414a5d;
	}
	
	.form-picker {
		width: 250rpx;
	}
	/deep/.uni-datetime-picker-timebox{
		font-size: 26rpx;
		color: #808080;
		border:0; 
		border-radius: 0; 
		padding: 0;
	}
	
	.date-pick-style{
		justify-content: flex-start;
		align-items: center;
		image{
			width:36rpx;
			height: 32rpx;
		}
		.text-input-hou{
			font-size: 26rpx;
			padding: 0 100rpx 0 20rpx;
		}
	}
	
	
	.checkbox-group-style{
		display: flex;
	}
	.checkbox{
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-right: 20rpx;
		color:#808080 ;
		// <image src="../../../../static/images/icon_checkbox_01.png" mode=""></image>
		.image-box{
			width: 30rpx;
			height: 30rpx;
			margin-right: 12rpx;
			background-image:url("../../../../static/images/icon_checkbox_02.png");
			background-size: 100% 100%; 
		}
	}
	.selectBox{
		color: #0099cc;
		.image-box{
			width: 30rpx;
			height: 30rpx;
			margin-right: 12rpx;
			background-image:url("../../../../static/images/icon_checkbox_01.png");
			background-size: 100% 100%; 
		}
		
	}
	/deep/.form-input-min{
		width: 300rpx;
	}
	.form-input-line{
		color: #808080;
		padding: 0 12rpx;
	}
	
	.box-detail-content {
		margin-top: 24rpx;
		padding: 0 10rpx;
		border-bottom: 8rpx solid #e8f0f2;
		
	}
	// .border {
	// 	;
	// }
	.border-wid{
		// border-bottom: 4px solid #0099cc;
	}
	.border-none{
		border-bottom:0;
	}
	.box-detail-content-item {
		display: flex;
		flex-direction: row;
		// justify-content: flex-start;
		// justify-content: space-between;
		margin-bottom: 20rpx;
	
		.row-title {
			width: 220rpx;
			font-size: 26rpx;
			color: #9a9a9a;
			text-align: left;
			flex-shrink: 0;
			margin-right: 10rpx;
	
			&.mag {
				margin-left: 18rpx;
			}
		}
	
		.row-content {
			font-size: 26rpx;
			color: #414a5d;
			word-wrap: break-word;
			word-break: break-all;
			flex: 1;
			text-align: left;
	
			&.mag {
				margin-right: 18rpx;
			}
		}
		
		.content-style{
			display: flex;
			justify-content: flex-end;
			align-items: center;
			image{
				width: 27rpx;
				height: 27rpx;
			}
			.history-name{
				margin-left: 10rpx;
				font-family: AlibabaPuHuiTi-Regular;
				font-size: 24rpx;
				color: #0099cc;
			}
		}
	}
	
	.bar-contact {
		background-color: #0099cc;
		border-radius: 10px;
		height: 40rpx;
		line-height: 40rpx;
		padding-left: 18rpx;
		color: #FFFFFF;
		font-size: 24rpx;
		
	}
	.box-attach{
		margin-top: 20rpx;
		padding: 0 10rpx;
	}
	.box-attach-row {
		display: flex;
		align-items: center;
		padding: 0 18rpx;
		height: 38rpx;
		margin-bottom: 10rpx;
		.box-attach-icon {
			width: 34rpx;
			margin-right: 30rpx;
		}
		.box-attach-name {
			font-size: 26rpx;
			color: #0099cc;
		}
	}
	.fixed-action-bar{
		width: 100%;
		display: flex;
		height: 70rpx;
		align-items: center;
		background: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 999;
		.item{
			width: 50%;
			display: flex;
			justify-content: center;
			align-items: center;
			
		}
		.icon{
			width: 30rpx;
		}
		.btn-box{
			width: 90rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 70rpx;
		}
		.text-edit{
			font-size: 24rpx;
			color: #0099cc;
			line-height: 70rpx;
		}
		.text-delete{
			font-size: 24rpx;
			color: #cc3357;
			line-height: 70rpx;
		}
	}
	
	.box-detail {
		min-height: 760rpx;
		background-color: #ffffff;
		border-radius: 20rpx;
		margin: 20rpx;
		padding: 26rpx 30rpx 50rpx 30rpx;
	}
	.item-index-top{
		// width: 650rpx;
		height: 40rpx;
		// margin: 20rpx 20rpx 18rpx 20rpx;
		background-color: #0099cc;
		border-radius: 10rpx;
		.item-top-text{
			font-family: AlibabaPuHuiTi-Regular;
			padding-left: 20rpx;
			font-size: 26rpx;
			font-weight: normal;
			line-height: 40rpx;
			letter-spacing: 0px;
			color: #ffffff;
		}
	}
	.item-top{
		display: flex;
		justify-content: space-between;
		.setion-left{
			display: flex;
			flex-direction: column;
			.left-text-top{
				font-size: 30rpx;
				font-weight: 600;
				color: #414a5d;
			}
			.left-text-bot{
				margin-top: 22rpx;
				font-size: 26rpx;
				color: #7f7f7f;
			}
		}
		.setion-right{
			display: flex;
			flex-direction: column;
			align-items: flex-end;
			.right-text-top{
				height: 30rpx;
				line-height: 30rpx;
				font-size: 26rpx;
				font-weight: normal;
				color: #9a9a9a;
			}
			.right-text-bot{
				margin-top: 22rpx;
				font-size: 28rpx;
				font-weight: normal;
				color: #999999;
			}
		}
	}
	.box-detail-header {
		display: flex;
		justify-content: space-between;
		margin-bottom: 8rpx;
	
		.name {
			font-size: 30rpx;
			color: #414a5d;
			font-weight: bold;
		}
	
		.date {
			font-size: 26rpx;
			color: #9a9a9a;
		}
	}
	
	.box-net {
		font-size: 26rpx;
		color: #0099cc;
	}
	
	.box-detail-content {
		margin-top: 24rpx;
		padding: 0 10rpx;
		border-bottom: 8rpx solid #e8f0f2;
		position: relative;
	}
	.delete-item{
		width:54rpx;
		height: 54rpx;
		background: url(../../../../static/images/icon_del.png);
		background-size:36rpx 36rpx ;
		background-repeat: no-repeat;
		background-position:18rpx 0; 
		position: absolute;
		z-index: 100;
		top: 0;
		right: 0;
	}
	.add-box-detail-content{
		height: 120rpx;
		background-image: url(../../../../static/images/add.png);
		background-repeat: no-repeat;
		background-position: 50% 24%;
		background-size: 160rpx 46rpx;
		
	}
	// .border {
	// 	;
	// }
	
	.box-detail-content-item {
		display: flex;
		flex-direction: row;
		// align-items: center;
		// justify-content: flex-start;
		// justify-content: space-between;
		margin-bottom: 20rpx;
	
		.row-title {
			width: 170rpx;
			font-size: 26rpx;
			color: #414a5d;
			text-align: left;
			flex-shrink: 0;
			margin-right: 10rpx;
	
			&.mag {
				margin-left: 18rpx;
			}
		}
	
		.row-content {
			font-size: 26rpx;
			color: #414a5d;
			word-wrap: break-word;
			word-break: break-all;
			flex: 1;
			text-align: left;
	
			&.mag {
				margin-right: 18rpx;
			}
		}
	}
	
	.bar-contact {
		background-color: #0099cc;
		border-radius: 10px;
		height: 40rpx;
		line-height: 40rpx;
		padding-left: 18rpx;
		color: #FFFFFF;
		font-size: 24rpx;
		
	}
	.box-attach{
		margin-top: 20rpx;
		padding: 0 10rpx;
	}
	.box-attach-row {
		display: flex;
		align-items: center;
		padding: 0 18rpx;
		height: 38rpx;
		margin-bottom: 10rpx;
		.box-attach-icon {
			width: 34rpx;
			margin-right: 30rpx;
		}
		.box-attach-name {
			font-size: 26rpx;
			color: #0099cc;
		}
	}
	.fixed-action-bar{
		width: 100%;
		display: flex;
		height: 70rpx;
		align-items: center;
		background: #fff;
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 999;
		.item{
			width: 50%;
			display: flex;
			justify-content: center;
			align-items: center;
			
		}
		.icon{
			width: 30rpx;
		}
		.btn-box{
			width: 90rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 70rpx;
		}
		.text-edit{
			font-size: 24rpx;
			color: #0099cc;
			line-height: 70rpx;
		}
		.text-delete{
			font-size: 24rpx;
			color: #cc3357;
			line-height: 70rpx;
		}
	}
	
	.uni-input{
		font-size: 26rpx;
		color: #808080;
		// border-bottom:1px solid #dce4e6;
		flex:1;
	}
	.textarea-style{
		height:156rpx ;
	}
	.box-detail-content {
		padding: 0 10rpx;
		margin-top: 24rpx;
	
		&.border {
			border-bottom: 1px solid #e8f0f2;
		}
	}
	
	.box-detail-content-row {
		display: flex;
		justify-content: space-between;
		margin-bottom: 20rpx;
	
		.row-title {
			font-size: 26rpx;
			color: #9a9a9a;
			text-align: left;
			flex-shrink: 0;
			width: 120rpx;
			margin-right: 10rpx;
	
			&.mag {
				margin-left: 18rpx;
			}
		}
	
		.row-content {
			font-size: 26rpx;
			color: #414a5d;
			word-wrap: break-word;
			word-break: break-all;
			flex: 1;
			text-align: right;
	
			&.mag {
				margin-right: 18rpx;
			}
		}
	}
	
	
</style>
